package com.empire.module.member.dal.mysql.hotelrecord;

import java.util.*;

import com.empire.framework.common.pojo.PageResult;
import com.empire.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.empire.framework.mybatis.core.mapper.BaseMapperX;
import com.empire.module.member.dal.dataobject.hotelrecord.HotelRecordDO;
import org.apache.ibatis.annotations.Mapper;
import com.empire.module.member.controller.admin.hotelrecord.vo.*;

/**
 * 旅馆住宿 Mapper
 *
 * @author 主席大人
 */
@Mapper
public interface HotelRecordMapper extends BaseMapperX<HotelRecordDO> {

    default PageResult<HotelRecordDO> selectPage(HotelRecordPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<HotelRecordDO>()
                .eqIfPresent(HotelRecordDO::getPersonId, reqVO.getPersonId())
                .likeIfPresent(HotelRecordDO::getHotelName, reqVO.getHotelName())
                .eqIfPresent(HotelRecordDO::getHotelAddress, reqVO.getHotelAddress())
                .betweenIfPresent(HotelRecordDO::getCheckInTime, reqVO.getCheckInTime())
                .betweenIfPresent(HotelRecordDO::getCheckOutTime, reqVO.getCheckOutTime())
                .eqIfPresent(HotelRecordDO::getRoomNo, reqVO.getRoomNo())
                .likeIfPresent(HotelRecordDO::getCheckInPersonName, reqVO.getCheckInPersonName())
                .eqIfPresent(HotelRecordDO::getCheckInPersonPhone, reqVO.getCheckInPersonPhone())
                .betweenIfPresent(HotelRecordDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(HotelRecordDO::getId));
    }

}